export function SET_NAME(state, { name }) {
  return {
    ...state,
    name
  }
}

export function SHALLOW_COPY_GLOBAL_STATE(state) {
  return {
    ...state
  }
}

export function REVERT_PERCENTS(state, payload = {}) {
  const { percents } = state
  return {
    ...state,
    percents: [...percents].reverse()
  }
}

export function FETCH_PAGE_DATA(state, payload = {}) {
  const { order } = payload
  state = TO_UPDATE_ORDER(state, { order })
  return state
}

export function TO_UPDATE_ORDER(state, { order }) {
  return SET_ORDER(state, { order })
}

export function SET_ORDER(state, { order }) {
  return {
    ...state,
    order
  }
}

export function FETCH_USER(state, payload = {}) {
  const { user } = payload
  return {
    ...state,
    user,
  }
}

export function TO_UPDATE_LIST(state, { list }) {
  return {
    ...state,
    list
  }
}
